
//计算部分
function accAdd(arg1,arg2){
    var r1,r2,m;
    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
    m=Math.pow(10,Math.max(r1,r2))
    return (arg1*m+arg2*m)/m
}
function accMul(arg1,arg2)
{
    var m=0,s1=arg1.toString(),s2=arg2.toString();
    try{m+=s1.split(".")[1].length}catch(e){}
    try{m+=s2.split(".")[1].length}catch(e){}
    return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
}
function subtr(arg1,arg2){
     var r1,r2,m,n;
     try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
     try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
     m=Math.pow(10,Math.max(r1,r2));
     //last modify by deeka
     //动态控制精度长度
     n=(r1>=r2)?r1:r2;
     return ((arg1*m-arg2*m)/m).toFixed(n);
}

function Youa (obj){
	 this.obj = $youa(obj);
	 this.container = $youa("container");
	 this.control = $youa("control");
	 this.items = $$$("item", this.container);
	 this.iCenter = 2;
	 this.aSort = [];
	 this.timer = null;
	 this.oData = [
	  {left:0, zIndex:2, opacity:30},
	  {left:40, zIndex:3, opacity:60},
	  {left:124, zIndex:4, opacity:100},
	  {left:208, zIndex:3, opacity:60},
	  {left:246, zIndex:2, opacity:30},
	  {left:40, zIndex:0, opacity:0}
	 ];
	 this.__create__();
};
Youa.prototype.__create__ = function (){
	 var that = this;
	 var oSpan = null;
	 var i = 0;
	 for (i = 0; i < that.items.length; i++)
	 {
	  that.items[i].number = i;
	  that.aSort[i] = that.items[i];
	  oSpan = document.createElement("span");
	  oSpan.number = i;
	  that.control.appendChild(oSpan)
	 }
	 for (i = 0; i < 2; i++) this.aSort.unshift(this.aSort.pop());
	 that.aSpan = $$("span", that.control); 
	 that.control.onmouseover = function (ev)
	 {
	  var oEv = ev || event;
	  var oTarget = oEv.target || oEv.srcElement;  
	  if (oTarget.tagName.toUpperCase() == "SPAN")
	  {
	   that.aSort.sort(function (a, b) {return a.number - b.number});
	   if (oTarget.number < that.iCenter)
	   {
	    for (i = 0; i < that.iCenter - oTarget.number; i++) that.aSort.unshift(that.aSort.pop()); 
	    that.__set__();
	    return false
	   }
	   else if (oTarget.number > that.iCenter)
	   {
	    for (i = 0; i < oTarget.number - that.iCenter; i++) that.aSort.push(that.aSort.shift());
	    that.__set__();
	    return false
	   }
	   else
	   {
	    that.__set__()
	   }
	  }
	 }
	 this.__set__();
	 this.__switch__();
	 this.__autoPlay__()
};
Youa.prototype.__set__ = function (){
	 var i = 0;
	 for (i = 0; i < this.aSort.length; i++) this.container.appendChild(this.aSort[i]);
	 for (i = 0; i < this.aSpan.length; i++) this.aSpan[i].className = "";
	 this.aSpan[this.aSort[this.iCenter].number].className = "active";
	 for (i = 0; i < this.aSort.length; i++)
	 {
	  this.aSort[i].index = i;  
	  if (i < 5)
	  {
	   new Animate(this.aSort[i], this.oData[i]);
	  }
	  else
	  {
	   new Animate(this.aSort[i], this.oData[this.oData.length - 1])
	  }
	 }
};
Youa.prototype.__switch__ = function (){
	 var i = 0;
	 var that = this;
	 this.container.onclick = function (ev)
	 {
	  var oEv = ev || event;
	  var oTarget = oEv.target || oEv.srcElement;
	  var index = findItem(oTarget);
	  
	  if (index < that.iCenter)
	  {
	   for (i = 0; i < that.iCenter - index; i++) that.aSort.unshift(that.aSort.pop());
	   that.__set__();
	   return false
	  }
	  else if (index > that.iCenter)
	  {
	   for (i = 0; i < index - that.iCenter; i++) that.aSort.push(that.aSort.shift());
	   that.__set__();
	   return false
	  }  
	  function findItem (element)
	  {
	   return element.className == "item" ? element.index : arguments.callee(element.parentNode)
	  }
	 };
};
Youa.prototype.__autoPlay__ = function (){
	 var that = this;
	 that.timer = setInterval(function ()
	 {
	  that.aSort[1].click()
	 }, 6000);
	 that.obj.onmouseover = function ()
	 {
	  clearInterval(that.timer)
	 };
	 that.obj.onmouseout = function ()
	 {
	  that.timer = setInterval(function ()
	  {
	   that.aSort[1].click()
	  }, 6000) 
	 }
};
function $youa(id){
	return typeof id === "string" ? document.getElementById(id) : id
};
function $$ (tagName, oParent){
	return (oParent || document).getElementsByTagName(tagName) 
};
function $$$ (className, element, tagName){
	 var i = 0;
	 var aClass = [];
	 var reClass = new RegExp("(^|//s)" + className + "(//s|$)");
	 var aElement = $$(tagName || "*", element || document);
	 for (i = 0; i < aElement.length; i++) reClass.test(aElement[i].className) && aClass.push(aElement[i]);
	 return aClass
};
function css (element, attr, value){
	 if (arguments.length == 2)
	 {
	  if (typeof arguments[1] === "string")
	  {
	   return element.currentStyle ? element.currentStyle[attr] : getComputedStyle(element, null)[attr] 
	  }
	  else
	  {
	   for (var property in attr)
	   {
	    property == "opacity" ?
	    (element.style.filter = "alpha(opacity=" + attr[property] + ")", element.style.opacity = attr[property] / 100) :
	    element.style[property] = attr[property]
	   }
	  }
	 }
	 else if (arguments.length == 3)
	 {
	  switch (attr)
	  {
	   case "width":
	   case "height":
	   case "top":
	   case "left":
	   case "right":
	   case "bottom":
	    element.style[attr] = value + "px";
	    break;
	   case "opacity" :
	    element.style.filter = "alpha(opacity=" + value + ")";
	    element.style.opacity = value / 100;
	    break;
	   default :
	    element.style[attr] = value;
	    break
	  } 
	 }
	 return element
};
function Animate (element, options, fnCallBack){
	 this.obj = $youa(element);
	 this.options = options;
	 this.__onEnd__ = fnCallBack;
	 this.__startMove__()
	};
	Animate.prototype.__startMove__ = function ()
	{
	 var that = this;
	 clearInterval(that.obj.timer);
	 that.obj.timer = setInterval(function ()
	 {
	  that.__doMove__()
	 }, 30);
	};
	Animate.prototype.__doMove__ = function ()
	{
	 var complete = true;
	 var property = null;
	 for (property in this.options)
	 {
	  var iCur = parseFloat(css(this.obj, property));
	  property == "opacity" && (iCur = parseInt(iCur.toFixed(2) * 100));
	  var iSpeed = (this.options[property] - iCur) / 5;
	  iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
	  this.options[property] == iCur || (complete = false, css(this.obj, property, iSpeed + iCur))
	 }
	 complete && (clearInterval(this.obj.timer), this.__onEnd__ && this.__onEnd__.apply(this.obj))
};
	 
	 
//Close Object
function closeObj(obj){
	$(obj).fadeOut(240);
}

//getView
function getView(obj){
	if($(obj).is(":hidden")){
		$(obj).slideDown();
	}else{
		$(obj).slideUp();
	}
}
//DialogBuy
/*
function getDialogBuy(){
	var psize = ___getPageSize() ,psroll = ___getPageScroll() ,thisH = $("#DialogBuy").height() ,thisW = $("#DialogBuy").width();
	$("#DialogBuy").css({
		top:psroll[1] + ( psize[3] - thisH ) / 2,
		left:psroll[0] + ( psize[2] - thisW ) / 2
	}).hide().fadeIn(240);
}
*/
function getDialogBuy(obj){
	var offset = $(obj).offset() ,objH = $(obj).height() ,objW = $(obj).width() ,thisW = $("#DialogBuy").width();
	$("#DialogBuy").css({
		top:offset.top + objH,
		left:offset.left - (thisW - objW) / 2
	}).hide().fadeIn(240);
	
}
//==================================================
//获取内容层内容原始尺寸
function getConSize(conId){
	var conObj=document.getElementById(conId)
	conObj.style.position = "absolute";
	conObj.style.left=-1000+"px";
	conObj.style.display="";
	var arrayConSize=[conObj.offsetWidth,conObj.offsetHeight]
	conObj.style.display="none";
	return arrayConSize;
}
function insertAfter(newElement,targetElement){//插入
	var parent = targetElement.parentNode;
	if(parent.lastChild == targetElement){
	parent.appendChild(newElement);
	}
	else{
	parent.insertBefore(newElement,targetElement.nextSibling);
	}
}
function ___getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
};
/**
 / THIRD FUNCTION
 * getPageScroll() by quirksmode.com
 *
 * @return Array Return an array with x,y page scroll values.
 */
function ___getPageScroll() {
	var xScroll, yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll);
	return arrayPageScroll;
};

//
/*
ver 1.100901;
ver 1.101125;
*/

//Dialog
var Dialog = function(){
	var alert = function(msg,callback){
		var x = new div("dialog","Alert");
		x.alert(msg,callback);
	};
	
	var confirm = function(msg,title,callback){
		var x= new div("dialog","Confirm");
		x.confirm(msg,title,callback);
	};
	
	var get = function(obj,title,callback){
		var x = new div("dialog","Getdiv");
		x.get(obj,title,callback);
	};
	
	
	return {
		alert:alert,
		confirm:confirm,
		get:get
	};
}();

//Div
function div(c,d){
	this.c = c;
	this.d = d;
	if($("#"+d).length < 1){
		$("body").append("<div class='"+c+"' id='"+d+"'><div class='"+c+"-title'><h3></h3><a href='javascript:'>×</a></div><div class='"+c+"-cont'></div><div class='"+c+"-button'></div></div>");
		
		if($("#bgDiv").length < 2){
			$("body").append("<div id='bgDiv'></div>");
			$("#bgDiv").css("opacity",0.5);
		}
		
		var ow = $("#"+d).width(),
		oh =  $("#"+d).height(),
		bw = document.documentElement.clientWidth || document.body.clientWidth,
		bh = document.documentElement.clientHeight || document.body.clientHeight,
		bs = document.documentElement.scrollTop || document.body.scrollTop;
	
		$("#"+d).css({
			top:(bh - oh) / 2 - 10 + bs,
			left:(bw - ow) / 2,
			opacity:0,
			display:"block"
		}).animate({
				top:(bh - oh) / 2 - 60 + bs,
				opacity:1
			},120,function(){
				$(this).animate({
					top:(bh - oh) / 2 + 5 + bs -50
				},80,function(){
					$(this).animate({
					top:(bh - oh) / 2 + bs -50
					},40)
				})
		});
		
		if(bh > $("body").height()){
			$("#bgDiv").css({
				width:bw,
				height:bh
			}).show();
		}else{
			$("#bgDiv").css({
				width:bw,
				height:$("body").height()
			}).show();
		}
		
		$("#"+d + " ." + c + "-title a").click(function(){
			$(this).parent().parent().animate({
				width:0,
				height:0,
				top:bh + bs,
				left:bw / 2,
				opacity:0
			},240,function(){
				$("#"+d).remove()
			})
			
			$("#bgDiv").remove();
		});
	}/*else{
		alert("页面已存在ID："+d+"，请更换一个ID")
	}*/
	
	$("."+c + "-title").mouseover(function(){
		$(this).css("cursor","move");
		$(this).mousedown(function(event){
			var o = $(this).parent();
			$(this).css("cursor","move").parent().css("opacity",0.8);
			event = window.event || event;
			var offset = o.offset();
			var a = event.clientX;
			var b = event.clientY;
			document.onmousemove = function(event){
				event = window.event || event;
				o.css({
					top:(event.clientY - b + offset.top) < 0 ? 0 : event.clientY - b + offset.top,
					left:(event.clientX - a + offset.left) < 0 ? 0 : event.clientX - a + offset.left
				})
			}
		}).mouseup(function(){
			$(this).parent().css("opacity",1);
			document.onmousemove = null
		   $(this).css("cursor","default");
		})
	})
}

div.prototype.alert = function(msg,callback){
	$("."+this.c+"-cont").html(msg);
	$("."+this.c+"-title h3").html("提示");
	$("."+this.c+"-button").html("<button>确定</button>");
	//$("."+this.c+"-button button").focus();
	
	var o = "#" + this.d, c = "." + this.c + "-title";
	
	$(c).children("a").click(function(){
		if(typeof callback == "function"){
			callback();
		}
	});
	
	$("."+this.c+"-button button").click(function(){
		$(c).children("a").click();
	});
}

div.prototype.confirm = function(msg,title,callback){
	$("."+this.c+"-cont").html(msg);
	$("."+this.c+"-button").html("<button class='btn_submit'>确定</button><button class='btn_cancel'>取消</button>")
	//$("."+this.c+"-button button.btn_submit").focus();
	
	var o = "#" + this.d, c = "." + this.c + "-title";
	
	if(typeof title == "string"){
		$("."+this.c+"-title h3").html(title)
	}else if(typeof title == "function"){
		callback = title;
		$("."+this.c+"-title h3").html("是否确定？");
	}else{
		$("."+this.c+"-title h3").html("是否确定？");
	}
	
	$("."+this.c+"-button button.btn_submit").click(function(){
		$(c).children("a").click();
		if(typeof callback == "function"){
			callback();
		}
	});
	
	$("."+this.c+"-button button.btn_cancel").click(function(){
		$(c).children("a").click();
	})
}

div.prototype.prompt = function(){

}

div.prototype.get = function(obj,title,callback){
	$(obj).show();
	$("."+this.c+"-cont").append($(obj));
	$("."+this.c).width($(obj).width() + 80);
	var bw = document.documentElement.clientWidth || document.body.clientWidth,
		thisWidth = $("."+this.c).width();
	$("."+this.c).css("left",(bw - thisWidth)/2);
	if(typeof title == "string"){
		$("."+this.c+"-title h3").html(title);
	}else if(typeof title == "function"){
		callback = title;
	}

	if(typeof callback == "function"){
		callback();
	}
	
	$("."+this.c+"-title a").click(function(){
		$(obj).clone().appendTo("body").hide();
	})
}

//Encode
function urlencode(str) {
    return escape(str).replace(/\+/g, '%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
} 

//Cookie
jQuery.cookie = function(name, value, options) {
	if (typeof value != 'undefined') {
		options = options || {};
		if (value === null) {
			value = '';
			options = $.extend({}, options);
			options.expires = -1;
		}
		var expires = '';
		if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
			var date;
			if (typeof options.expires == 'number') {
				date = new Date();
				date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
			} else {
				date = options.expires;
			}
			expires = '; expires=' + date.toUTCString();
		}
		var path = options.path ? '; path=' + (options.path) : '';
		var domain = options.domain ? '; domain=' + (options.domain) : '';
		var secure = options.secure ? '; secure' : '';
		document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
		} else {
			var cookieValue = null;
			if (document.cookie && document.cookie != '') {
			var cookies = document.cookie.split(';');
			for (var i = 0; i < cookies.length; i++) {
				var cookie = jQuery.trim(cookies[i]);
				if (cookie.substring(0, name.length + 1) == (name + '=')) {
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
					break;
				}
			}
		}
		return cookieValue;
	}
};
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
          -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
          -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
          -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
          52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
          -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
          15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
          -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
          41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);

function base64encode(str) {
    var out, i, len;
    var c1, c2, c3;

    len = str.length;
    i = 0;
    out = "";
    while (i < len) {
        c1 = str.charCodeAt(i++) & 0xff;
        if (i == len) {
            out += base64EncodeChars.charAt(c1 >> 2);
            out += base64EncodeChars.charAt((c1 & 0x3) << 4);
            out += "==";
            break;
        }
        c2 = str.charCodeAt(i++);
        if (i == len) {
            out += base64EncodeChars.charAt(c1 >> 2);
            out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
            out += base64EncodeChars.charAt((c2 & 0xF) << 2);
            out += "=";
            break;
        }
        c3 = str.charCodeAt(i++);
        out += base64EncodeChars.charAt(c1 >> 2);
        out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
        out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
        out += base64EncodeChars.charAt(c3 & 0x3F);
    }
    return out;
}

function base64decode(str) {
    var c1, c2, c3, c4;
    var i, len, out;

    len = str.length;
    i = 0;
    out = "";
    while (i < len) {
        /*   c1   */
        do {
            c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
        } while (i < len && c1 == -1);
        if (c1 == -1)


            break;

        /*   c2   */
        do {
            c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
        } while (i < len && c2 == -1);
        if (c2 == -1)
            break;

        out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));

        /*   c3   */
        do {
            c3 = str.charCodeAt(i++) & 0xff;
            if (c3 == 61)
                return out;
            c3 = base64DecodeChars[c3];
        } while (i < len && c3 == -1);
        if (c3 == -1)
            break;

        out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));

        /*   c4   */
        do {
            c4 = str.charCodeAt(i++) & 0xff;
            if (c4 == 61)
                return out;
            c4 = base64DecodeChars[c4];
        } while (i < len && c4 == -1);
        if (c4 == -1)
            break;
        out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
    }
    return out;
}
function urlencode(str) {
     return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}        

function EncodeURI(unzipStr,isCusEncode){
    if(isCusEncode){
        var zipArray = new Array();
        var zipstr = "";
        var lens = new Array();
        for(var i=0;i<unzipStr.length;i++){
         var ac = unzipStr.charCodeAt(i);
         zipstr += ac;
         lens = lens.concat(ac.toString().length);
        } 
        zipArray = zipArray.concat(zipstr);
        zipArray = zipArray.concat(lens.join("O"));
        return zipArray.join("N");
    }else{
        //return encodeURI(unzipStr);
        var zipstr=""; 
        var strSpecial="!\"\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
        var tt= "";
        for(var i=0;i<unzipStr.length;i++){ 
            var chr = unzipStr.charAt(i); 
            var c=StringToAscii(chr); 
            tt += chr+":"+c+"n"; 
            if(parseInt("0x"+c) > 0x7f){ 
                 zipstr+=encodeURI(unzipStr.substr(i,1));
            }else{ 
                 if(chr==" ") 
                    zipstr+="+"; 
                 else if(strSpecial.indexOf(chr)!=-1) 
                    zipstr+="%"+c.toString(16); 
                 else 
                    zipstr+=chr; 
                } 
            } 
        return zipstr; 
    }
}
function DecodeURI(zipStr,isCusEncode){
    if(isCusEncode){
        var zipArray = zipStr.split("N");
        var zipSrcStr = zipArray[0];
        var zipLens;
        if(zipArray[1]){
            zipLens = zipArray[1].split("O");    
        }else{
            zipLens.length = 0;
        }
        
        var uzipStr = "";
        
        for(var j=0;j<zipLens.length;j++){
            var charLen = parseInt(zipLens[j]);
            uzipStr+= String.fromCharCode(zipSrcStr.substr(0,charLen));
            zipSrcStr = zipSrcStr.slice(charLen,zipSrcStr.length);
        }        
        return uzipStr;
    }else{
        //return decodeURI(zipStr);
        var uzipStr=""; 
        for(var i=0;i<zipStr.length;i++){ 
            var chr = zipStr.charAt(i); 
            if(chr == "+"){ 
                 uzipStr+=" "; 
            }else if(chr=="%"){ 
                 var asc = zipStr.substring(i+1,i+3); 
                 if(parseInt("0x"+asc)>0x7f){ 
                     uzipStr+=decodeURI("%"+asc.toString()+zipStr.substring(i+3,i+9).toString()); ; 
                     i+=8; 
                 }else{ 
                     uzipStr+=AsciiToString(parseInt("0x"+asc)); 
                     i+=2; 
                 } 
            }else{ 
                 uzipStr+= chr; 
            } 
        } 
        return uzipStr;
    }
}
function StringToAscii(str){
    return str.charCodeAt(0).toString(16);
}
function AsciiToString(asccode){
    return String.fromCharCode(asccode);
}


$(function(){
	//Service List
	$("#ServiceList").hover(function(){
		$(this).children("ul").show();
	},function(){
		$(this).children("ul").hide();
	});
	
	//CartCount
	$("#CartCount").hover(function(){
		$("#CartCont").fadeIn(320);
	},function(){
		$("#CartCont").fadeOut(320);
	});
	
	//Search Text
	var STxt = $("#SearchText").val();
	$("#SearchText").focus(function(){
		var TTxt = $(this).val();
		TTxt == STxt ? $(this).val("").css("color","#4a4a4a") : null ;
	}).blur(function(){
		var TTxt = $(this).val();
		TTxt == "" ? $(this).val(STxt).css("color","#DDD") : null ;
	});
	
	//RankList
	$("#RankList ul li").each(function(i){
		if(i>2){
			$("em",this).addClass("rank2");
		}
	});
	
	$("#RankList ul li").hover(function(){
		$(this).addClass("active").siblings().removeClass("active");
	});
	
	$("#RankList ul li:first").mouseover();
})


//SlideShow
function SlideShow(obj){
	var i = $("li",obj).length, w = $("li",obj).width();
	var x=-1, timer=5000, T;
	$("ul",obj).width(i * w);
	$(obj).append("<p id='SlideTxt'></p>");
	
	for(var n = 0;n < i; n++){
		var txt = $("li",obj).eq(n).text();
		var url = $("li a",obj).eq(n).attr("href");
		$("#SlideTxt").append("<a href='"+url+"' target='_blank'>"+txt+"</a>");
	}
	
	$("#SlideTxt a").hover(function(){
		x = $("#SlideTxt a").index($(this));
		$(this).addClass("active").css("opacity",0.5).siblings().removeClass("active").css("opacity",1);
		$("ul",obj).stop().animate({
			marginLeft: - x * w
		});
		
		clearTimeout(T)
	},function(){
		T = setTimeout(timeout,timer);
	});
	
	var timeout = function(){
		x<i-1 ? x++ : x =0;
		$("#SlideTxt a").eq(x).mouseover();	
		T = setTimeout(timeout,timer);
	}
	
	timeout();
	
	$("li",obj).hover(function(){
		clearTimeout(T)
	},function(){
		T = setTimeout(timeout,timer);
	});
}